package xyz.ddlnt.serviceusr.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.PageDTO;
import xyz.ddlnt.model.dto.UserContentInteractionDTO;
import xyz.ddlnt.model.vo.PrivateMessageListVO;
import xyz.ddlnt.serviceusr.service.PrivateMessageListService;

import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/26 16:46
 */
@Slf4j
@Tag(name = "私信列表接口测试")
@RequestMapping("/private_message_list")
@RestController
public class PrivateMessageListController {
    @Resource
    private PrivateMessageListService privateMessageListService;

    /**
     * 判断(并插入)私信列表
     * @param userContentInteractionDTO
     * @return
     */
    @PostMapping("/judgeAndInsertPrivateMessageList")
    public Result<Integer> JudgeAndInsertPrivateMessageList(@RequestBody UserContentInteractionDTO userContentInteractionDTO) {
        return Result.success(privateMessageListService.JudgeAndInsertPrivateMessageList(userContentInteractionDTO));
    }

    /**
     * 获取私信列表
     * @param pageDTO
     * @return
     */
    @PostMapping("/listPrivateMessageList")
    public Result<List<PrivateMessageListVO>> listPrivateMessageList(@RequestBody PageDTO pageDTO) {
        return Result.success(privateMessageListService.listPrivateMessageList(pageDTO));
    }

    /**
     * 删除私信
     * @param userContentInteractionDTO
     * @return
     */
    @DeleteMapping("/deletePrivateMessage")
    public Result<Boolean> deletePrivateMessage(@RequestBody UserContentInteractionDTO userContentInteractionDTO) {
        return Result.success(privateMessageListService.deletePrivateMessage(userContentInteractionDTO));
    }


}
